#include "types.h"
#include "stat.h"
#include "user.h"
#include "fcntl.h"

int
main(int argc, char* argv[])
{
	char* path, *oldName, *newName;
	int rename_result;

	if (argc != 4) {
    		printf(2, "Usage: ren <path> <oldName> <newName>\n");
    		exit();
  	}
	
	path = argv[1];
	oldName = argv[2];
	newName = argv[3];

	rename_result = rename(path, oldName, newName);

	if(rename_result < 0){
		printf(2, "failed to rename the file %s\n", oldName);
	}

	exit();
} 
